package com.example.easeimpro.controller.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.hyphenate.chat.EMOptions;
import com.hyphenate.easeui.widget.EaseTitleBar;

public class BaseActivity extends AppCompatActivity implements EaseTitleBar.OnBackPressListener{
    public Context mContext;
    public Handler handler = new Handler();
    public EMOptions options;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContext = this;
        options = new EMOptions();
    }

    /**
     * 跳转Activity
     * @param cls
     */
    public void IntentNextActivity(Class cls){
        Intent intent = new Intent(mContext,cls);
        startActivity(intent);
    }
    public void showToast(String msg){
        handler.post(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(mContext,msg,Toast.LENGTH_SHORT).show();
            }
        });

    }

    @Override
    public void onBackPress(View view) {
        finish();
    }
}
